# Distributed under the terms of the GNU General Public License v2

EAPI=7

PYTHON_COMPAT=( python3+ )
VALA_MIN_API_VERSION=0.34
VALA_USE_DEPEND=vapigen

inherit vala autotools python-r1 xdg-utils

DESCRIPTION="BAMF Application Matching Framework"
HOMEPAGE="https://launchpad.net/bamf"
SRC_URI="https://api.launchpad.net/1.0/bamf/0.5/0.5.6/+file/bamf-0.5.6.tar.gz/file -> bamf-0.5.6.tar.gz"
KEYWORDS="*"

LICENSE="LGPL-3"
SLOT="0"
IUSE="doc +dbus +introspection static-libs"
RESTRICT="test"

RDEPEND="
	dev-libs/dbus-glib
	dev-libs/glib:2
	gnome-base/libgtop:2
	x11-libs/gtk+:3
	x11-libs/libX11
	>=x11-libs/libwnck-3.4.7:3
	dbus? ( dev-libs/libdbusmenu )
"
DEPEND="${RDEPEND}
	x11-libs/startup-notification
	introspection? ( dev-libs/gobject-introspection )
"
BDEPEND="
	$(vala_depend)
	${PYTHON_DEPS}
	dev-libs/libxml2[${PYTHON_USEDEP}]
	dev-util/gdbus-codegen
	doc? ( dev-util/gtk-doc )
	virtual/pkgconfig"

AUTOTOOLS_AUTORECONF=yes
DOCS=(AUTHORS COPYING COPYING.LGPL ChangeLog NEWS README TODO)


src_prepare(){
	xdg_environment_reset
	default
	eautoreconf
	vala_src_prepare
}


src_configure() {
	python_setup
	local econfargs=(
		--disable-headless-tests
		--disable-gtktest
		$(use_enable doc gtk-doc)
		$(use_enable dbus export-actions-menu)
		$(use_enable introspection)
		VALA_API_GEN="${VAPIGEN}"
	)
	econf "${econfargs[@]}" "$@"

}